import { lazy } from 'react'
import { createBrowserRouter, Outlet } from 'react-router-dom'
import {
	HomeOutlined,
	SettingOutlined,
	UserAddOutlined,
	MenuOutlined,
	UserOutlined,
	ApartmentOutlined,
	BarChartOutlined
} from '@ant-design/icons';
const Layout = lazy(() => import('../pages/Layout/Index'))
const NotFound = lazy(() => import('../pages/NotFound/Index'))
const Home = lazy(() => import('../pages/Home/Index'))
const User = lazy(() => import('../pages/User/Index'))
const Role = lazy(() => import('../pages/Role/Index'))
const Menu = lazy(() => import('../pages/Menu/Index'))
const Bumen = lazy(() => import('../pages/Bumen/Index'))
const House = lazy(() => import('../pages/House'))
export const RouterChildrenList = [
	{
		path: '/home',
		element: <Home />,
		icon: <HomeOutlined />,
		meta: {
			role: [1, 2],
			title: '首页'
		}
	},
	{
		path: '/wind',
		element: <Outlet />,
		icon: <SettingOutlined />,
		meta: {
			role: [1, 2],
			title: '系统管理'
		},
		children: [
			{
				path: '/wind/user',
				element: <User />,
				icon: <UserOutlined />,
				meta: {
					role: [1, 2],
					title: '用户管理'
				}
			},
			{
				path: '/wind/role',
				element: <Role />,
				icon: <UserAddOutlined />,
				meta: {
					role: [1, 2],
					title: '角色管理'
				}
			},
			{
				path: '/wind/menu',
				element: <Menu />,
				icon: <MenuOutlined />,
				meta: {
					role: [1, 2],
					title: '菜单管理'
				}
			},
			{
				path: '/wind/bumen',
				element: <Bumen />,
				icon: <ApartmentOutlined />,
				meta: {
					role: [1, 2],
					title: '部门管理'
				}
			}
		]
	},
	{
		path: '/house',
		element: <House />,
		icon: <BarChartOutlined />,
		meta: {
			role: [1, 2],
			title: '租房管理'
		}
	}
]
export const RouterList = createBrowserRouter([
	{
		path: '/',
		element: <Layout />,
		children: RouterChildrenList
	},
	{
		path: '*',
		element: <NotFound />
	}
])